<?php
session_start();
require_once("../db_connect.php");
require_once("filter.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet"  href="../../css/admin.css" type="text/css" />
<title>管理者画面</title>
</head>
       <body>
		<div id="topmain" >
			<div id="topwaku">管理ページ</div>
				<div id="enpty"></div>
					<div id="topimage"><a href="manager_create.php" >管理者登録</a></div>
					<div id="topimage"><a href="ManagerLogout.php" >ログアウト</a></div>
		</div>
		<div id="leftmain">
			<div id="leftmainwaku">
				<div id="koumoku"><a href="../../manager_index.php" >・管理トップページ</a></div>
				<div id="koumoku"><a href="manage_main_category.php" >メインカテゴリ一覧</a></div>
				<div id="koumoku"><a href="manage_user.php" >・会員一覧</a></div>
				<div id="koumoku"><a href="manage_treatment.php" >・待遇一覧</a></div>
			</div>
		</div>
		<div id="centerup">
			<div id="centerinsert">
			<div id="centerinsert2">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.corner.js"></script>
<script type="text/javascript">

	//未入力項目をチェックする
	function chValie() {
	//入力必須項目（「,」で区切って追加可能）
	ess = new Array("volunteer_Name","age","Location","access","Conditions","application_number");
	for(i=0; i<ess.length; i++) {
	txt = document.volForm.elements[ess[i]].value;
	if(txt == "") {
	 alert("未入力の項目があります");
	 return false;
	}
	}
	return true;
	}

	$(document).ready(
		function() {
			$('.box').corner();
			$('.box2').corner();
			$('.box3').corner();
			$('.box4').corner();
	});

	$(document).ready(
			function() {
				$("#volunteer").click(function () {
					$("#target").attr({
						action: "./PHP/serch_function/index_search.php?target=volunteer"
					});
				});

				$("#thread").click(function () {
					$("#target").attr({
						action: "./PHP/serch_function/index_search.php?target=threads"
					});
				});

				$('.box').corner();
				$('.box2').corner();
				$('.box3').corner();
				$('.box4').corner();
				<?php
					echo array_key_exists("error",$_SESSION)?"login_error('".htmlspecialchars($_SESSION['error'],ENT_QUOTES,"UTF-8")."');":"";
					unset($_SESSION["error"]);
				?>
		});
		function login_error(error){
			alert(error);
		}

</script>
<title>Insert title here</title>
</head>
<body>
<form action="ManageVolunteerInsert.php"  method="POST" name="volForm" onSubmit="return chValie()" >
ボランティア名<input type="text" name="volunteer_Name" /><br>
活動内容<textarea name="content" rows="1" cows="40"></textarea><br>
カテゴリ<select name="sub_category_id" >
<?php
	$sql = "SELECT sub_category_id,sub_category_name
			FROM sub_category";

	$sth = $db->query($sql);
	if (DB::isError($sth)) {
	  exit($sth->getMessage());
	}

	//カテゴリ表示
	while ($data = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
		echo "<option value='".$data['sub_category_id']."' >".$data['sub_category_name']."</option>";
	}
?>
</select><br>
対象年齢<input type="text" name="age" /><br>
対象性別
<select name="Target_Gender">
<option value="不問">不問</option>
<option value="男">男</option>
<option value="女">女</option>
</select><br>
実働時間<input type="text" name="work_time" /><br>
活動開始日<select name="Activity_Date_year">
<?php
$now_y = date("Y");
$now_m = date("M");
$now_d = date("D");
for($i = $now_y; $i<= $now_y+5; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>年
<select name="Activity_Date_month">
<?php
for($i = 1; $i<=12; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>月
<select name="Activity_Date_day">
<?php
for($i = 1; $i<=31; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>日<br>

活動終了日<select name="End_time_year">
<?php
$now = date("Y");
for($i = $now; $i<= $now+5; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>年
<select name="End_time_month">
<?php
for($i = 1; $i<=12; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>月
<select name="End_time_day">
<?php
for($i = 1; $i<=31; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>日<br>
活動場所<input type="text" name="Location" /><br>
アクセス方法<input type="text" name="access" /><br>
条件<input type="text" name="Conditions" /><br>
応募人数<input type="text" name="application_number" /><br>
待遇
<?php
	$sql = "SELECT treatment_id,treatment_name
			FROM treatment";

	$sth = $db->query($sql);
	if (DB::isError($sth)) {
	  exit($sth->getMessage());
	}

	//カテゴリ表示
	while ($data = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
		echo "<input type='checkbox' name='treatment_id' value='".$data['treatment_id']."' />".$data['treatment_name'];
	}


?>
<br>
その他<textarea name="other" rows="1" cows="40"></textarea><br>
掲載終了日<select name="Posted_Date_year">
<?php
$now = date("Y");
for($i = $now; $i<= $now+5; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>年
<select name="Posted_Date_month">
<?php
for($i = 1; $i<=12; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>月
<select name="Posted_Date_day">
<?php
for($i = 1; $i<=31; $i++):?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php endfor;?>
</select>日
<br>
<input type="submit" value="登録" />
</form>
</div>
</div>
</div>
</body>
</html>

